package org.timemanager.view;

import android.app.Activity;
import android.app.Service;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Vibrator;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;

/**
 * show alarm when time limit
 * @author Dereky
 *
 */
public class AlarmAlertActivity extends Activity {
	private MediaPlayer mediaPlayer;
	private Vibrator vibrator;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.alarm_alert);
		findViewById(R.id.alert_button).setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				AlarmAlertActivity.this.finish();
			}
		});
		
		mediaPlayer=MediaPlayer.create(this, R.raw.apple);
		mediaPlayer.start();
		vibrator = (Vibrator)getSystemService(Service.VIBRATOR_SERVICE);
		vibrator.vibrate(2000);
		
//	    new AlertDialog.Builder(AlarmAlertActivity.this)
//        		.setIcon(R.drawable.clock)
//        		.setTitle(getText(R.string.alarm_alert_over_time_title))
//        		.setMessage(getText(R.string.alarm_alert_over_time_message))
//        		.setPositiveButton(getText(R.string.alarm_alert_over_time_ok),
//        				new DialogInterface.OnClickListener(){
//			          	public void onClick(DialogInterface dialog, int whichButton)
//			          	{
//			          		AlarmAlertActivity.this.finish();
//			          	}
//        		}).show();
	}

	@Override
	protected void onDestroy() {
		mediaPlayer.stop();
		super.onDestroy();
		
	}
	
}
